//
//  NSObject+Unicode.m
//  XXProject
//
//  Created by 谢曦 on 2017/4/13.
//  Copyright © 2017年 xiexi. All rights reserved.
//

#import "NSObject+decription.h"

@implementation NSObject (decription)
-(NSString *)xx_description{
    NSString *desc = [self description];
    desc = [NSString stringWithCString:[desc cStringUsingEncoding:NSUTF8StringEncoding] encoding:NSNonLossyASCIIStringEncoding];
    return desc;
}




@end
@implementation NSArray (decription)

- (NSString *)xx_descriptionWithLocale:(id)locale
{
    NSMutableString *str = [NSMutableString stringWithFormat:@"%lu (\n", (unsigned long)self.count];
    
    for (id obj in self) {
        [str appendFormat:@"\t%@, \n", obj];
    }
    
    [str appendString:@")"];
    
    return str;
}
@end


@implementation NSDictionary (decription)

- (NSString *)xx_descriptionWithLocale:(id)locale
{
    NSArray *allKeys = [self allKeys];
    NSMutableString *str = [[NSMutableString alloc] initWithFormat:@"{\t\n "];
    for (NSString *key in allKeys) {
        id value= self[key];
        [str appendFormat:@"\t \"%@\" = %@,\n",key, value];
    }
    [str appendString:@"}"];
    
    return str;
}

@end
